
export interface EventBusOperation<State = any> {
  $on: (
    //监听
    event: string,
    callback: (context: BaseEventBus<State>) => void
  ) => EventBusOperation;
  $off: (
    //取消监听
    event: string,
    callback: Function
  ) => EventBusOperation;
  $once: (
    //只监听一次
    event: string,
    callback: (context: BaseEventBus<State>) => void
  ) => EventBusOperation;
  $emit: (event: string, ...args: any[]) => EventBusOperation; //发送事件
  $clear: Function; //清除监听
}

export interface BaseEventBus<State = any> {
  prefix?: string; //event前缀
  operation: EventBusOperation<State>; //操作栏
  state?: Partial<State>; //数据
  events: {
    //当前属于该总线监听事件数组
    event: string;
    func: Function;
  }[];
}
